package com.liangzhong.model.activity
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	/**
	 *充值活动 
	 * @author lake
	 * 
	 */	
	public class ActivityRechargeOneVo extends EventDispatcher
	{
		/**
		 *已充值天数 
		 */		
		public var qDays 		:int = 0;
		/**
		 *总充值数 
		 */		
		public var totalValues 		:int;
		/**
		 *充值数组 每天充值
		 */		
		public var rechargeValues	:Array = [];
		/**
		 * 达标数组 
		 */		
		public var targetFlags		:Array = [];
		/**
		 *奖励数组 
		 */		
		public var values		:Array = [1,3,5,7,13];
		/**
		 *领取状态 
		 */		
		public var recStatus	:Array = [4,4,4,4,4];
		
		public function ActivityRechargeOneVo()
		{
			for(var i :int = 0;i<14;i++)
			{
				rechargeValues.push(0);
				targetFlags.push(0);
			}
		}
		/**
		 *返回充值级别 
		 * @return 
		 * 
		 */		
		public function get qLevel():int
		{
			var lv :int = 0;
			if(qDays >= 1 && qDays < 3)
			{
				lv = 1;
			}
			else if(qDays >= 3 && qDays < 5)
			{
				lv = 2;
			}
			else if(qDays >= 5 && qDays < 7)
			{
				lv = 3;
			}
			else if(qDays >= 7 && qDays < 13)
			{
				lv = 4;
			}
			else if(qDays >= 13)
			{
				lv = 5;
			}
			return lv;
		}
		/**
		 *解析数据 
		 * @param obj
		 * 
		 */		
		public function parse(obj :Object):void
		{
			qDays = obj.list.days;
			totalValues = obj.payamt;
			var itemObj :Object;
			var i :int = 0;
			for(i = 0;i < 5;i ++)
			{
				itemObj = obj.list["" + (i+1)];
				if(itemObj.is_get == 1)//可领取
				{
					recStatus[i] = 3;
				}
				if(itemObj.has_get == 1)//已经领取
				{
					recStatus[i] = 2;
				}
			}
			targetFlags = obj.list.date;
			//测试
			//qDays = 10;
			//recStatus = [2,3,3,3,4];
			//targetFlags = [1,1,1,1,1,1,1,1,0,0,1,0,1,0];
			this.dispatchEvent(new Event(Event.CHANGE));
		}
	}
}